//
//  Zone.m
//  07-内存管理
//
//  Created by LL.F on 16/7/12.
//  Copyright © 2016年 LL.F. All rights reserved.
//

#import "Zone.h"

@implementation Zone
-(void)dealloc
{

    [_name release];
    [_number release];
    [super dealloc];
    
}
- (instancetype)initWithName:(NSString *)name
{

    self = [super init];
    if (self) {
        _name = name;
    }
    return self;
}

+ (instancetype)zoneWithName:(NSString *)name
{

    return [[[self alloc] initWithName:name] autorelease];
}
- (instancetype)initWithName:(NSString *)name number:(NSString *)number
{

    self = [super init];
    if (self) {
        _name = name;
        _number = number;
    }
    return self;
}
+ (instancetype)zoneWithName:(NSString *)name number:(NSString *)number
{

    return [[[Zone alloc] initWithName:name number:number] autorelease];
    
}
- (void)setName:(NSString *)name
{

    if (_name != name) {
        [_name release];
        _name = [name retain];
    }
}
- (void)setNumber:(NSString *)number
{

    if (_number != number) {
        [_number release];
        _number = [number retain];
    }
}
- (instancetype)initWithTempCity:(TempCity *)tempCity
{

    return [self initWithName:tempCity.cityName number:tempCity.cityNumber];
}
+ (instancetype)zoneWithTempCity:(TempCity *)tempCity
{

    return [[[Zone alloc] initWithName:tempCity.cityName number:tempCity.cityNumber] autorelease];;
}












@end
